package main

import (
	"fmt"
	"gitee.com/larry_dev/gtpengine"
	"gitee.com/larry_dev/gtpengine/gtpcommand"
	"runtime"
	"strings"
	"time"
)

func main() {
	client, err := gtpcommand.NewCMDClientString("./normal.sh")
	if err != nil {
		panic(err)
	}
	gtp := gtpengine.NewGTPCommand(client)
	fmt.Println(runtime.NumGoroutine())
	gtp.OnAnalyze= func(s string) {
		arr:=strings.Fields(s)
		fmt.Println(arr)
	}
	gtp.ShowLog(true)
	fmt.Println("analyze")
	go gtp.Analyze(60)
	fmt.Println(runtime.NumGoroutine())
	time.Sleep(10*time.Second)
	res,_:=gtp.Name()
	fmt.Printf("%v\n",res)
	//result, _ := gtp.GenMove("B")
	//fmt.Printf("%v",result)
	fmt.Println(runtime.NumGoroutine())
	gtp.Quit()
	wait:=make(chan int)
	<-wait
}
